// const stdin  = process.stdin,
//       stdout = process.stdout,
//       { Transform } = require('stream');

// stdin.setEncoding('utf8');

// let tf = new Transform();

// tf._transform = function(chunk, encoding, callback) {
// this.push(Buffer(chunk.toString('utf-8').toUpperCase));
//   callback();
// };

// stdin.pipe(tf).pipe(stdout);
var fs = require("fs");
var path = require("path");

var filePath1 = path.join(__dirname,"./from.txt");
var readable = fs.createReadStream(filePath1);
var filePath2 = path.join(__dirname,"/to.txt");
var writable = fs.createWriteStream(filePath2);

readable.on("data",function(chunk){
    var stream = require("stream");
    var Readable = stream.Readable;
    var rs = new Readable();
    rs._read = function(){
        var big = chunk.toString("utf-8").toUpperCase();
        rs.push(big);
        rs.push(null);
    }
    rs.pipe(writable);
})
